<?php
/**
 * Created by PhpStorm.
 * User: xiaofeng
 * motto: 现在的努力是为了小时候吹过的牛逼！
 * Date: 2020/1/8
 * Time: 11:56
 */
namespace app\common\model\mysql;

use think\Model;

class AdminUser extends Model {

    public function getAdminUserByUsername($username)
    {

        if (empty($username)) {
            return false;
        }

        $where = [
            'username'=>trim($username)
        ];

        $result = $this->where($where)->find();

        return $result;

    }

    public function updateById($id, $data){

        $id = intval($id);

        if (empty($id) || empty($data) || !is_array($data)){
            return false;
        }

        $where = [
            'id'=>$id
        ];

      return $this->where($where)->update($data);

    }

}